﻿#include <iostream>
#include <vector>
using namespace std;

class Solution1 {
public:
    vector<int> missingTwo(vector<int>& nums) {
        int tmp = 0;

        //1、将所有要参与计算的数进行异或
        for (auto e : nums)
            tmp ^= e;
        for (int i = 1; i <= nums.size() + 2; ++i)
            tmp ^= i;

        int differ = 0;
        // 2. 找出 a，b 中⽐特位不同的那⼀位
        while (1)
        {
            if ((tmp >> differ) & 1) break;
            else differ++;
        }
        // 3. 根据 differ 位的不同，将所有的数划分为两类来异或
        int a = 0, b = 0;
        for (int x : nums)
        {
            if (((x >> differ) & 1) == 1) b ^= x;
            else a ^= x;
        }

        for (int i = 1; i <= nums.size() + 2; i++)
        {
            if (((i >> differ) & 1) == 1) b ^= i;
            else a ^= i;
        }

        return { a,b };
    }
};

class Solution2 {
public:
    string modifyString(string s) {
        int n = s.size();
        for (int i = 0; i < n; ++i)
        {
            if (s[i] == '?')
            {
                for (char ch = 'a'; ch < 'z'; ++ch)
                {
                    if ((i == 0 || ch != s[i - 1]) && (i == n - 1 || ch != s[i + 1]))
                    {
                        s[i] = ch;
                        break;
                    }
                }
            }
        }
        return s;
    }
};

int main()
{
	return 0;
}